//index.js
//获取应用实例
var app = getApp()
Page({
  data: {
    doAnData:{},
    days: '',
    dotAnFun: ''
  },

  onShareAppMessage: function () {
    return {
      title: "Python2生命期",
      desc: "升级Python3保平安",
      path: 'pages/index/index',
    }
  },



  onShow: function () {
    var i = 0
    var dotAnData = wx.createAnimation({
      timingFunction:"ease-out",
      transformOrigin: 'center center'
    })
    this.data.dotAnFun = setInterval(function () {
      dotAnData.rotate(20 * (++i)).step()
      this.setData({
        dotAnData: dotAnData.export()
      })
    }.bind(this), 200)

    var year = 2020
    var month = 4
    var date = 12
    var now = new Date()
    var endDate = new Date(year, month - 1, date)
    var leftTime = endDate.getTime() - now.getTime()
    var leftsecond = parseInt(leftTime / 1000)
    var day = Math.floor(leftsecond / (60 * 60 * 24))
    this.setData({days: day})

  },

  //事件处理函数
  bindViewTap: function() {
    wx.navigateTo({
      url: '../logs/logs'
    })
  },

  showText: function(event){

    wx.showModal({
      content: 'Python2将在2020年4月12日停止维护',
      duration: 2000,
      showCancel:false,
      confirmText: '知道了'
    })
  },

 
  onLoad: function () {
    // var that = this
    // //调用应用实例的方法获取全局数据
    // app.getUserInfo(function(userInfo){
    //   //更新数据
    //   that.setData({
    //     userInfo:userInfo,
    //   })
    // })
  },

  onHide: function(){
    clearInterval(this.data.dotAnFun);
  }
})
